package aufg3;

public class Exponential extends RandVar {

	double lambda;

	private double[] getRV(int sizeOfArray) {
		super.randomNumbers = new double[sizeOfArray];
		for (int i = 0; i < super.randomNumbers.length; i++) {
			super.randomNumbers[i] = (-Math.log(super.stdRNG
					.getNextRandomNumberWithRange(0, 1))) / calcLambda();
			// this.stdRNG.setSeed(i);
		}
		return super.randomNumbers;
	}

	private double calcLambda() {
		this.lambda = 1 / super.mean;
		return lambda;
	}
	
	public double getLambda() {
		return lambda;
	}

	public double calculateMean() {
		super.mean = 1 / calcLambda();

		return super.mean;
	}
	
	@Override
	public double calculateCoefﬁcientOfVariation() {
		super.coefﬁcientOfVariation = 1;
		return super.coefﬁcientOfVariation;
	}
	
	@Override
	public double calculateVariance() {
		super.variance = 1/ quadrat(calcLambda());
		return super.variance;
	}

	public static void main(String[] args) {
		Exponential e = new Exponential();

		e.setMean(5);
		double[] rv = e.getRV(16780);

//		System.out.println(e.numberArrayToString());

		System.out.println(e.calculateMean());
		System.out.println(e.calculateVariance());
		
	}

}
